class FoundmodesController < ApplicationController
  layout "application" 
  # GET /foundmodes
  # GET /foundmodes.xml
  def index
    @foundmodes = Foundmode.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @foundmodes }
    end
  end

  # GET /foundmodes/1
  # GET /foundmodes/1.xml
  def show
    @foundmode = Foundmode.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @foundmode }
    end
  end

  # GET /foundmodes/new
  # GET /foundmodes/new.xml
  def new
    @foundmode = Foundmode.new(params[:foundmode])
    if(request.post? and @foundmode.save)
      flash[:notice] = "Found Mode #{@foundmode.name} has been saved"
      @foundmode = Foundmode.new
    end
  end

  # GET /foundmodes/1/edit
  def edit
    @foundmode = Foundmode.find(params[:id])
  end

  # POST /foundmodes
  # POST /foundmodes.xml
  def create
    @foundmode = Foundmode.new(params[:foundmode])

    respond_to do |format|
      if @foundmode.save
        flash[:notice] = 'Foundmode was successfully created.'
        format.html { redirect_to(@foundmode) }
        format.xml  { render :xml => @foundmode, :status => :created, :location => @foundmode }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @foundmode.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /foundmodes/1
  # PUT /foundmodes/1.xml
  def update
    @foundmode = Foundmode.find(params[:id])

    respond_to do |format|
      if @foundmode.update_attributes(params[:foundmode])
        flash[:notice] = 'Foundmode was successfully updated.'
        format.html { redirect_to :action=>"index"}
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @foundmode.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /foundmodes/1
  # DELETE /foundmodes/1.xml
  def delete
    @foundmode = Foundmode.find(params[:id])
    @foundmode.destroy

    respond_to do |format|
      format.html { redirect_to(foundmodes_url) }
      format.xml  { head :ok }
    end
  end
end
